/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package Beans;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author Thiago
 */
@Entity
@Table(name = "endereco", catalog = "trust", schema = "")
/*
@NamedQueries({
    @NamedQuery(name = "Endereco.findAll", query = "SELECT e FROM Endereco e"),
    @NamedQuery(name = "Endereco.findByIdendereco", query = "SELECT e FROM Endereco e WHERE e.idendereco = :idendereco"),
    @NamedQuery(name = "Endereco.findByRuaEnd", query = "SELECT e FROM Endereco e WHERE e.ruaEnd = :ruaEnd"),
    @NamedQuery(name = "Endereco.findByBairroEnd", query = "SELECT e FROM Endereco e WHERE e.bairroEnd = :bairroEnd"),
    @NamedQuery(name = "Endereco.findByCidadeEnd", query = "SELECT e FROM Endereco e WHERE e.cidadeEnd = :cidadeEnd"),
    @NamedQuery(name = "Endereco.findByEstadoEnd", query = "SELECT e FROM Endereco e WHERE e.estadoEnd = :estadoEnd"),
    @NamedQuery(name = "Endereco.findByNumeroEnd", query = "SELECT e FROM Endereco e WHERE e.numeroEnd = :numeroEnd"),
    @NamedQuery(name = "Endereco.findByCepEnd", query = "SELECT e FROM Endereco e WHERE e.cepEnd = :cepEnd")})
*/
public class Endereco implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idendereco")
    private Integer idendereco;
    @Column(name = "ruaEnd")
    private String ruaEnd;
    @Column(name = "bairroEnd")
    private String bairroEnd;
    @Column(name = "cidadeEnd")
    private String cidadeEnd;
    @Column(name = "estadoEnd")
    private String estadoEnd;
    @Column(name = "numeroEnd")
    private String numeroEnd;
    @Column(name = "cepEnd")
    private String cepEnd;

    public Endereco() {
    }

    public Endereco(Integer idendereco) {
        this.idendereco = idendereco;
    }

    public Integer getIdendereco() {
        return idendereco;
    }

    public void setIdendereco(Integer idendereco) {
        Integer oldIdendereco = this.idendereco;
        this.idendereco = idendereco;
        changeSupport.firePropertyChange("idendereco", oldIdendereco, idendereco);
    }

    public String getRuaEnd() {
        return ruaEnd;
    }

    public void setRuaEnd(String ruaEnd) {
        String oldRuaEnd = this.ruaEnd;
        this.ruaEnd = ruaEnd;
        changeSupport.firePropertyChange("ruaEnd", oldRuaEnd, ruaEnd);
    }

    public String getBairroEnd() {
        return bairroEnd;
    }

    public void setBairroEnd(String bairroEnd) {
        String oldBairroEnd = this.bairroEnd;
        this.bairroEnd = bairroEnd;
        changeSupport.firePropertyChange("bairroEnd", oldBairroEnd, bairroEnd);
    }

    public String getCidadeEnd() {
        return cidadeEnd;
    }

    public void setCidadeEnd(String cidadeEnd) {
        String oldCidadeEnd = this.cidadeEnd;
        this.cidadeEnd = cidadeEnd;
        changeSupport.firePropertyChange("cidadeEnd", oldCidadeEnd, cidadeEnd);
    }

    public String getEstadoEnd() {
        return estadoEnd;
    }

    public void setEstadoEnd(String estadoEnd) {
        String oldEstadoEnd = this.estadoEnd;
        this.estadoEnd = estadoEnd;
        changeSupport.firePropertyChange("estadoEnd", oldEstadoEnd, estadoEnd);
    }

    public String getNumeroEnd() {
        return numeroEnd;
    }

    public void setNumeroEnd(String numeroEnd) {
        String oldNumeroEnd = this.numeroEnd;
        this.numeroEnd = numeroEnd;
        changeSupport.firePropertyChange("numeroEnd", oldNumeroEnd, numeroEnd);
    }

    public String getCepEnd() {
        return cepEnd;
    }

    public void setCepEnd(String cepEnd) {
        String oldCepEnd = this.cepEnd;
        this.cepEnd = cepEnd;
        changeSupport.firePropertyChange("cepEnd", oldCepEnd, cepEnd);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idendereco != null ? idendereco.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Endereco)) {
            return false;
        }
        Endereco other = (Endereco) object;
        if ((this.idendereco == null && other.idendereco != null) || (this.idendereco != null && !this.idendereco.equals(other.idendereco))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "View.Endereco[ idendereco=" + idendereco + " ]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }
    
}
